<?php 
session_start();
date_default_timezone_set("PRC"); 
$db = include('../Application/Common/Conf/config.php');  
$v_mid = '23160411';	
$key   =  $db['bankmd5'];
$v_url = 'http://182.92.234.86/dqchat/recharge/Receive.php';
$remark2 = '[url:=http://182.92.234.86/dqchat/recharge/AutoReceive.php]';

if(trim($_POST['v_oid'])<>"")					//判断是否有传递订单号
{
	$v_oid = trim($_POST['v_oid']); 
}
else
{
	$v_oid = date('Ymd',time()).$v_mid.date('His',time());//订单号，建议构成格式 年月日-商户号-小时分钟秒
}
	 
$v_amount = trim($_POST['choose']);                   //支付金额                 
$v_moneytype = "CNY";                                            //币种
$text = $v_amount.$v_moneytype.$v_oid.$v_mid.$v_url.$key;        //md5加密拼凑串,注意顺序不能变
$v_md5info = strtoupper(md5($text)); 
$id = trim($_POST['account']);  //客户ID
$cname = trim($_POST['username']);   //客户昵称
$jinbi = trim($_POST['hjinbi']);     //充值金币

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8;" />
<link href="css/style.css" type="text/css" rel="stylesheet">
<link  id="iepng" href="" type="text/css" rel="stylesheet">
<script>
   if(window.XMLHttpRequest)
    {
        document.getElementById('iepng').href="css/normal.css";
    }
</script>
<script type="text/javascript" src="../Public/js/jquery-1.11.0.min.js"></script>
<script>
$(function(){
		$(document).keypress(function(e) { 
          // 回车键事件 
		   if(e.which == 13) { 
				$('.charesure').trigger("click");
		   } 
         });
		$('.charesure').click(function(){
			<?php 
				$_SESSION['id'] = $id;
				$_SESSION['jinbi'] = $jinbi;				
				$host =  $db['DB_HOST'];
				$port =  $db['DB_PORT'];
				$dbname =  $db['DB_NAME'];
				$user =  $db['DB_USER'];
				$psw =  $db['DB_PWD'];
				$dbconn = pg_connect("host=$host port=$port dbname=$dbname user=$user password=$psw");			
				if($dbconn){				
					$sql = "INSERT INTO tbusercashflow (nuserid,ntype,nstate,corderid,coutorderid,fcash,nmoney,cpaytype) VALUES ('$id',1,0,'$v_oid','$v_oid',$v_amount,'$jinbi','网银在线');";				
					pg_query($dbconn,$sql);
				}
					
			?>
				$('#E_FORM').submit();
		})
	
})


</script>
</head>
<body>
<div class="charge_wrap">
	<ul class="charegeMenu">
		<li class="menuOn">
			<div class="menuPic pic01"></div>
			<div class="menuTitle">充值中心</div>
		</li>	
		<li>
			<div class="menuPic pic02"></div>
			<div class="menuTitle">会员购买</div>
		</li>
		<li>
			<div class="menuPic pic03"></div>
			<div class="menuTitle">配车购买</div>
		</li>		
	</ul>
	<div class="chargeMain">
		<div class="chargeTitle"><span>网银充值金币</span></div>
		<div class="step"><img src="../Public/img/step2.jpg" /></div>
			<ul class="chareform sure">
				<li><label>充值帐号：</label><span><?php echo $id;?></span></li>
				<li><label>用户昵称：</label><span><?php echo $cname;?></span></li>
				<li><label>购买虚拟币数量：</label><span><font><?php echo $jinbi;?></font>金币</span></li>
				<li><label>支付金额：</label><span><?php echo $v_amount;?>元</span></li>
				<li class="charesure">确认订单</li>
			</ul>			
<!--以下信息为标准的 HTML 格式 + PHP 语言 拼凑而成的 网银在线 支付接口标准演示页面 无需修改-->

		<form method="post" name="E_FORM" id="E_FORM" action="https://Pay3.chinabank.com.cn/PayGate?encoding=UTF-8">
			<input type="hidden" name="v_mid"         value="<?php echo $v_mid;?>">
			<input type="hidden" name="v_oid"         value="<?php echo $v_oid;?>">
			<input type="hidden" name="v_amount"      value="<?php echo $v_amount;?>">
			<input type="hidden" name="v_moneytype"   value="<?php echo $v_moneytype;?>">
			<input type="hidden" name="v_url"         value="<?php echo $v_url;?>">
			<input type="hidden" name="v_md5info"     value="<?php echo $v_md5info;?>">
		 
		 <!--以下几项项为网上支付完成后，随支付反馈信息一同传给信息接收页 -->	
			
			<input type="hidden" name="remark1"       value="<?php echo $remark1;?>">
			<input type="hidden" name="remark2"       value="<?php echo $remark2;?>">



		<!--以下几项只是用来记录客户信息，可以不用，不影响支付 -->
			<input type="hidden" name="v_rcvname"      value="<?php echo $v_rcvname;?>">
			<input type="hidden" name="v_rcvtel"       value="<?php echo $v_rcvtel;?>">
			<input type="hidden" name="v_rcvpost"      value="<?php echo $v_rcvpost;?>">
			<input type="hidden" name="v_rcvaddr"      value="<?php echo $v_rcvaddr;?>">
			<input type="hidden" name="v_rcvemail"     value="<?php echo $v_rcvemail;?>">
			<input type="hidden" name="v_rcvmobile"    value="<?php echo $v_rcvmobile;?>">

			<input type="hidden" name="v_ordername"    value="<?php echo $v_ordername;?>">
			<input type="hidden" name="v_ordertel"     value="<?php echo $v_ordertel;?>">
			<input type="hidden" name="v_orderpost"    value="<?php echo $v_orderpost;?>">
			<input type="hidden" name="v_orderaddr"    value="<?php echo $v_orderaddr;?>">
			<input type="hidden" name="v_ordermobile"  value="<?php echo $v_ordermobile;?>">
			<input type="hidden" name="v_orderemail"   value="<?php echo $v_orderemail;?>">
		</form>
	</div>
	
	<div style="clear:both"></div>
</div>
</body>
</html>